import 'package:flutter/material.dart';
import 'package:flutter_account_book/routes.dart';
import 'package:get/get.dart';

class SettingsPage extends StatelessWidget {
  const SettingsPage({super.key});

  Widget titleItem(BuildContext context, String title) {
    ThemeData themeData = Theme.of(context);
    return Padding(
        padding: EdgeInsets.fromLTRB(10, 5, 0, 0),
        child: Text(
          title,
          style: TextStyle(color: themeData.indicatorColor),
        ));
  }

  Widget cellItem(String title, {required String router, dynamic arguments}) {
    return InkWell(
      onTap: () {
        Get.toNamed(router, arguments: arguments);
      },
      child: ListTile(
        title: Text(title),
        contentPadding: EdgeInsets.fromLTRB(10, 0, 10, 0),
        trailing: const Icon(Icons.chevron_right),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("设置"),
      ),
      body: ListView(
        children: [
          titleItem(context, '支付'),
          cellItem("支付方式管理", router: Routers.payPage),
          titleItem(context, '记录'),
          cellItem("收入管理",
              router: Routers.recordTypePage, arguments: {"isIncome": 1}),
          cellItem("支出管理",
              router: Routers.recordTypePage, arguments: {"isIncome": 0}),
        ],
      ),
    );
  }
}
